function [output] = displaycorrelations(corrplanes, sups, corratts, interest, filename)
disp('local correlated');
if nargin < 4
    interest = 0;
end
if nargin >= 5
    fp = fopen(filename,'wt');
else
    fp = -1;
end

count = length(corrplanes);
for i=1:count
    if isinteresting(corrplanes{i}, interest)
        pstr = toplanestr(corrplanes{i},corratts{i});
        outstr = sprintf('%s\tsup=%f',pstr, sups(i));
        disp(outstr)
        if fp >=0
            fprintf(fp,outstr);
            fprintf(fp,'\n');
        end
    end
end
disp('count=');
disp(count);
if fp >=0
    fprintf(fp,'count=%d\n',count);
    fclose(fp);
end


%   Convert the coefficents and attributs of a plane to a string
function [planestr]=toplanestr(coes,atts)
s = '';
for i=1:length(atts)
    st = sprintf('(%f)x%d+',coes(i),atts(i));
    s = strcat(s,st);
end
st = sprintf('(%f)=0',coes(end));
s = strcat(s,st);
planestr=s;

%  Check the rule is interesting
function [ret]=isinteresting(coes, interest)
ret = 0;
for i=1:length(coes)-1
    if abs(coes(i)) >= interest && abs(coes(i)-1) >= interest && abs(coes(i)+1) >= interest
        ret = 1;
        return;
    end
end

    
    
